package electronics.base;

public class Computer extends Electronics{
    /*
	 * the CPUversion of the Computer
	 */
    private String CPUversion;
    /*
	 * the RAM of the Computer
	 */
	private String RAM;
	
	public Computer() {

	}
    /*
	 * Construct a <code>Computer</code> object
	 */
	public Computer(double weight,double price,int powercosumption,String producer,String CPU,String RAM){
		super(weight,price,powercosumption,producer);
		CPUversion=CPU;
		this.RAM=RAM;
	}
    /*
	 * get the CPUversion of the Computer
	 */
	public String getCPUversion() {
		return CPUversion;
	}
    /*
	 * change the CPUversion of the Computer
	 * @param newCPUver
	 */
	public void setCPUversion(String newCPUver) {
		CPUversion=newCPUver;
	}
    /*
	 * get the RAM of the Computer
	 */
	public String getRAM() {
		return RAM;
	}
    /*
	 * change the CPUversion of the Computer
	 * @param newRAM
	 */
	public void setRAM(String newRAM) {
		RAM=newRAM;
	}
    /*
	 * import the information of the Computer
	 */
	public void showInfo() {
		System.out.println("CPUversion："+CPUversion);
		System.out.println("RAM:"+RAM);
	}

    /**
		 * compare the two computer property
		 * @param C the compared object
		 * @return if C have same property of  the computer
		 */
		//the initial method equal can judge between two phone object ,so make a new equal method
		public boolean equalComputer(Computer C) {
			boolean isEqual=false;
			if(this.CPUversion.equals(C.getCPUversion())&&this.RAM.equals(C.getRAM())){
				if(super.getPowerConsumption()==C.getPowerConsumption()&&super.getPrice()==C.getPrice()) {
					if(super.getProducer().equals(C.getProducer())&&super.getWeight()==C.getWeight())
						isEqual=true;
				}			
			}
			return isEqual;
		}
}
